#!/bin/bash
#SBATCH --job-name=GWAS
#SBATCH --account=gem
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=10
#SBATCH --mem=64gb
#SBATCH --time=24:00:00

genotype_file=$1
covar_file=$2
pheno_file=$3
output_dir=$4

plink2 --pfile ${genotype_file} \
--maf 0.01 \
--geno 0.05 \
--max-alleles 2 \
--glm 'hide-covar' \
--1 \
--covar ${covar_file} \ # Sample ID (IID), followed by covariates as cols
--pheno 'iid-only' ${pheno_file} \ # Sample ID (IID) and SBS12 status
--ci 0.95 \
--parameters 1,5 \
--out ${output_dir}